/**
 * RequestParamTrimFilter.java
 * Created at 2016年8月26日
 * Created by Jackie Liu
 * Copyright (C) 2016, All rights reserved.
 */
package com.huabo.interceptor;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * <p>ClassName: RequestParamTrimFilter</p>
 * <p>Description: 对请求参数去除前后空格过滤器</p>
 * <p>Author: Jackie Liu</p>
 * <p>Date: 2016年8月26日</p>
 */
public class RequestParamTrimFilter implements Filter {

	/* (non-Javadoc)
	 * <p>Title: init</p>
	 * <p>Description: </p>
	 * @param filterConfig
	 * @throws ServletException
	 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
	 */
	@Override
	public void init(FilterConfig filterConfig) throws ServletException {}

	/* (non-Javadoc)
	 * <p>Title: doFilter</p>
	 * <p>Description: </p>
	 * @param request
	 * @param response
	 * @param chain
	 * @throws IOException
	 * @throws ServletException
	 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
	 */
	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		chain.doFilter(new RequestParamTrimWrapper((HttpServletRequest) request), response);
	}

	/* (non-Javadoc)
	 * <p>Title: destroy</p>
	 * <p>Description: </p>
	 * @see javax.servlet.Filter#destroy()
	 */
	@Override
	public void destroy() {}

}
